﻿using System;
using ASPNETVN.PORTAL.Components.UI;

namespace LMHTX.Modules.DIRECTORY.COOPERATIVE.Controls
{
    public partial class EmployeeManager : AddEditItemControl
    {
        protected override void OnInit(EventArgs e)
        {
            this.ButtonUpdate = btnAdd;
            this.ButtonCancel = btnCancel;

            this.Update += EmployeeManager_Update;
            base.OnInit(e);
        }

        void EmployeeManager_Update(object sender, EventArgs e)
        {
            SqlDataSource1.Insert();
            this.ResetInputData();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                ddlJobTitle.SelectedValue = Request.QueryString["jobtitle"];
                ddlJobTitle.Enabled = false;
            }
        }

        private void ResetInputData()
        {
            txtFullName.Text = "";
            txtAppointingYear.Text = "";
        }
    }
}